import request from '@/config/axios'

export interface orderVO {
  id: string
  name: string
  status: number
  handlerName: string
  handlerParam: string
  cronExpression: string
  retryCount: number
  retryInterval: number
  monitorTimeout: number
  createTime: Date
}


// 查询订单管理列表
export const getOrderPage = (data: PageParam) => {
  return request.post({ url: '/project/order/page', data })
}

// 查询订单详情
export const getOrderDetailPage = (id: string) => {
  return request.get({ url: '/project/order/get?id=' + id  })
}

// 导出
export const exportSupplier = (outType) => {
  return request.download({ url: '/project/order-detail/exportTemplate?orderType=' + outType })
}

// 查询订单物料详情
export const getOrderDetail = (data: PageParam) => {
  return request.post({ url: '/project/order-detail/page', data })
}

//查询订单状态/导入模板状态
export const getStatus = (params: PageParam) => {
  return request.get({ url: '/system/dict-data/page', params })
}

// 修改订单详情列表
export const editOrderDetail = (data) => {
  return request.put({ url: '/project/order-detail/edit', data })
}

// 修改订单管理列表
export const editOrder = (data) => {
  return request.put({ url: '/project/order/update', data })
}

// 查询订单物料详情
export const listOrderDetail = (data: PageParam) => {
  return request.post({ url: '/project/order-detail/pageOrderDetail', data })
}

// 导出订单管理列表
export const exportOrder = async (params) => {
  return await request.download({ url: `/project/order/export-excel`, params })
}

// 导出订单详情信息
export const exportOrderDetail = async (params) => {
  return await request.download({ url: `/project/order-detail/exportOrderDetail`, params })
}

// 查询订单管理列表
export const getOrderAndDispatchList = (data: PageParam) => {
  return request.post({ url: '/project/order/getOrderAndDispatchList', data })
}

// 导出订单管理列表
export const exportOrderAndDispatchList = async (params) => {
  return await request.download({ url: `/project/order/exportOrderAndDispatchList`, params })
}

export const deleteOrder = async (id: number) => {
  return await request.delete({ url: `/project/order/delete?id=` + id })
}
